[#ftl]
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>资源</title>
<css>
<link rel="stylesheet" type="text/css" href="${base}/commonjs/ztree/css/zTreeStyle/zTreeStyle.css" />
</css>
<script type="text/javascript" src="${base}/commonjs/ztree/js/jquery.ztree.all-3.5.min.js" ></script>
 
 
<script  type="text/javascript" >
// show a simple loading indicator
$(document).ready(function(){
    var loaderMask = dialog({
    	content: '<div id="loader"><img src="${base}/images/loading.gif" alt="loading..."></div>'
	});
	var loader = jQuery('<div id="loader"><img src="${base}/images/loading.gif" alt="loading..."></div>')
		.css({
			position: "absolute",
			top: "50%",
			left: "50%",
		})
		.prependTo("body")
		.hide();
	loader.ajaxStart(function() {
		//$(this).show();
		//loaderMask.showModal();
		loaderMask.show();
	}).ajaxStop(function() {
		//loader.hide();
		loaderMask.close();
	}).ajaxError(function(a, b, e) {
	    //loader.hide();
	    loaderMask.close();
		throw e;
	});
})
</script>
<script type="text/javascript">
$(document).ready(function(){
	var setting = {
			view: {
				selectedMulti: false
			},
			async: {
				enable: true,
				url:"childResources",
				autoParam:["id"],
				dataFilter: filter
			},
			callback: {
				beforeClick: beforeClick,
				beforeAsync: beforeAsync,
				onAsyncError: onAsyncError,
				onAsyncSuccess: onAsyncSuccess,
				onClick: zTreeOnClick
			}
		};
	
    function filter(treeId, parentNode, childNodes) {
		if (!childNodes) return null;
		for (var i=0, l=childNodes.length; i<l; i++) {
			childNodes[i].name = childNodes[i].name.replace(/\.n/g, '.');
		}
		return childNodes;
	}
	
	function beforeClick(treeId, treeNode) {
	}
	
	function zTreeOnClick(event, treeId, treeNode) {
	    
    	 $.ajax({
	    	  url: "resource/"+ treeNode.id+"/update", 
	    	  type:"GET",
	    	  dataType:"html",
	    	  cache: false,
	    	  success: function(val){
	    	     $("#detail").html(val);		          	 
	          },
	          error:function(XMLHttpRequest, textStatus, errorThrown){
	          	 //alert(XMLHttpRequest.readyState + XMLHttpRequest.status + XMLHttpRequest.responseText);
	          }
	      });
	};
	
	var  className = "dark";
	function beforeAsync(treeId, treeNode) {
		className = (className === "dark" ? "":"dark");
		//showLog("[ "+getTime()+" beforeAsync ]&nbsp;&nbsp;&nbsp;&nbsp;" + ((!!treeNode && !!treeNode.name) ? treeNode.name : "root") );
		return true;
	}
	
	function onAsyncError(event, treeId, treeNode, XMLHttpRequest, textStatus, errorThrown) {
		//showLog("[ "+getTime()+" onAsyncError ]&nbsp;&nbsp;&nbsp;&nbsp;" + ((!!treeNode && !!treeNode.name) ? treeNode.name : "root") );
	}
	
	function onAsyncSuccess(event, treeId, treeNode, msg) {
		//showLog("[ "+getTime()+" onAsyncSuccess ]&nbsp;&nbsp;&nbsp;&nbsp;" + ((!!treeNode && !!treeNode.name) ? treeNode.name : "root") );
		// alert(msg);
	}
 
	$.fn.zTree.init($("#resouceTree"), setting);
	 
});
</script>

</head>
<body> 
    <div class="right_top"><span class="pl20 f14">模块管理</span></div>
    <!-- 数据信息开始 -->
    <div class="date_list">
    	<div class="fl">
    		<div class="pl60 f14 pt8">所有功能列表</div>
    		<div class="pl60 f12 lh36">
    			<ul id="resouceTree" class="ztree"></ul>
    		</div>
    	</div>
    	<div id="detail" class="fl list_right pt8 mr100" ><img src="../images/date_03.png" alt="" /></div>
    	<div class="blank_1"></div>
    </div>
    <div class="bottom"> </div>
</body>
</html>